﻿@using BestTrader.Cms.ViewModels
@{
    ViewData["Title"] = "返佣记录";
    var AgentManagers = ViewData["AgentManagers"] as List<ItemsDetailModel>;
    var  IsFinanceAdmin = (Boolean)ViewData["IsFinanceAdmin"] ;
}

<blockquote class="layui-elem-quote quoteBox">

    <form class="layui-form">
        @Html.AntiForgeryToken()
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" class="layui-input searchVal" placeholder="请输入用户名称或真实姓名" />
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="startdate" id="startdate" lay-verify="startdate" placeholder="开始时间" autocomplete="off" class="layui-input startdate" readonly>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="enddate" id="enddate" lay-verify="enddate" placeholder="结束时间" autocomplete="off" class="layui-input enddate" readonly>
            </div>
        </div>

        <div class="layui-input-inline">
            <div class="layui-input-inline">
                <select name="searchState" class="searchState" lay-filter="searchState" lay-verify="required">
                    <option value="">所有客户</option>
                    @foreach (var item in AgentManagers)
                    {
                        <option value="@item.ItemCode">@(item.ItemData):@(item.ItemName)</option>
                    }
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline ml-4">
                <input type="radio" name="searchDateType" value="1" title="按结算日">
                <input type="radio" name="searchDateType" value="0" title="按交易日" checked>
            </div>
        </div>
        <div class="layui-inline">
            <a class="layui-btn search_btn" data-type="reload">搜索</a>
        </div>
        @if(IsFinanceAdmin  == true)
        {
        <div class="layui-inline">
            <a class="layui-btn layui-btn-warm excel_btn">导出</a>
        </div>
        }
    </form>
    <table class="layui-table">
        <colgroup>
            <col width="150">
            <col width="200">
            <col width="200">
            <col>
        </colgroup>
        <thead>
            <tr>
                <th>开平数量合计</th>
                <th>返佣金额合计</th>
                <th>返佣金额(RMB)合计</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td id="txtTotalQuantity"> </td>
                <td id="txtTotalRebateMoney"> </td>
                <td id="txtTotalRebateRMBMoney"> </td>
                <td></td>
            </tr>
        </tbody>
    </table>
</blockquote>
<table id="rebateList" lay-filter="rebateList"></table>
<!--操作-->
<script type="text/html" id="rebateListBar">
    @*<a class="layui-btn layui-btn-sm" lay-event="preview">查看</a>*@
    @*<a class="layui-btn layui-btn-sm" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a>*@
</script>
<script type="text/html" id="IsLock">
    {{#  if(d.IsLock ===true){ }}
    <input type="checkbox" name="IsLock" value="{{d.Id}}" lay-filter="IsLock" lay-skin="switch" lay-text="是|否" checked>
    {{#  } else{ }}
    <input type="checkbox" name="IsLock" value="{{d.Id}}" lay-filter="IsLock" lay-skin="switch" lay-text="是|否">
    {{#  }}}
</script>
<script type="text/html" id="State">
    {{#  if(d.State === 1){ }}
    <a class="layui-btn layui-btn-xs">通过</a>
    {{#  } else if(d.State === 2){ }}
    <a class="layui-btn layui-btn-xs layui-btn-disabled">不通过</a>
    {{#  } else{ }}
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="state">未审核</a>
    {{#  }}}
</script>
@section Scripts{
    <script type="text/javascript" src="~/layui-v2.4.5/layui.js"></script>
    <script type="text/javascript" src="~/js/rebate/rebateList.js?_=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
}